跳到主要内容

Windows 系统中 Powershell 按键设置

· 阅读需 1 分钟

在使用 Powershell 时,有时想绑定一些自定义的快捷键,可以使用如下两条命令:

Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

注,powershell profile 的位置可以使用如下命令查看:

$PROFILE | Select-Object *

详见 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.3